# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# Old Maintainer: Kyle Keen <keenerd@gmail.com>
# Old Contributor: Andy Weidenbaum <archbaum@gmail.com>

pkgname=python2-prompt_toolkit1
_pkgname=prompt_toolkit
pkgver=1.0.15
pkgrel=3
pkgdesc='Library for building powerful interactive command lines in Python.'
url='https://pypi.org/project/prompt-toolkit/#files'
arch=('any')
license=('BSD')
depends=('python2' 'python2-wcwidth' 'python2-pygments' 'python2-six')
makedepends=('python2-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('10981be2ed8b71d0cd9f663c4de047cec9664d9276968c6eec40dc45b388d1acf8eba07d534369254f178931079bf39b04eb2ceac06aa63a2021ebf62387b2f5')

prepare() {
  cd "$_pkgname-$pkgver"

  # stolen from AL community
  # rearrange a bunch of stuff to avoid version conflicts
  mv -f prompt_toolkit prompt_toolkit1
  find ./ -type f -exec sed -i -e 's/prompt_toolkit/prompt_toolkit1/g' {} \;
}

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

